<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>组件的概念</title>
</head>
<body>
<div id="app">
  <button-counter></button-counter><br>
  <button-counter></button-counter><br>
  <button-counter></button-counter><br>
</div>

<script src="../vue.global.js"></script>
<script>
  app = Vue.createApp({})
  app.component('button-counter',{
    data(){
      return{
        counter: 100,
      }
    },
    template: `
      计算器: {{counter}}
      <button @click="counter++">counter++</button>
    `
  })
  app.mount('#app')
</script>
</body>
</html>
